// Singer Related Api
import request from 'Utils/request'

/**
 * Get classify list of singer.
 * http://m.kugou.com/singer/class&json=true
 */
export function getSingerClassify () {
    return new Promise((resolve, reject) => {
        request
            .get('/mApi/singer/class&json=true')
            .then(data => {
                resolve(data)
            })
            .catch(err => {
                reject(err)
            })
    })
}

/**
 * Get singer list based on classify.
 * http://m.kugou.com/singer/list/88?json=true
 * @param {String} classid The sign of classify.
 */
export function getSingerList (classid) {
    return new Promise((resolve, reject) => {
        request
            .get(`/mApi/singer/list/${classid}?json=true`)
            .then(data => {
                resolve(data)
            })
            .catch(err => {
                reject(err)
            })
    })
}

/**
 * Get Singer info based on the sign of singer.
 * http://m.kugou.com/singer/info/3060&json=true
 * @param {String} singerid The sign of singer.
 */
export function getSingerInfo (singerid) {
    return new Promise((resolve, reject) => {
        request
            .get(`/mApi/singer/info/${singerid}?json=true`)
            .then(data => {
                resolve(data)
            })
            .catch(err => {
                reject(err)
            })
    })
}
